02.19.01 - changed some parameter interactions such as load doesn't need a spellbook param
Work Needed:
- !!! Major Error in Design: SpellBook, when updated will invalidate previously
serialized SpellBooks of earlier version. It is smarter to have a special
format that writes several java objects like ints, vectors, & strings.
- need to make a backup method that keeps a separate record, char based file (gzipped)
- add more accessory functions like wrappered autosaves, etc.
- add import function which takes a tab-delineated text file and converts
it to a SpellRecord
Work Completed:
- added the parent parameter for save as and load from so FileChooser can show dialog.
- changed load parameters
*/
/*
This file and its intellectual contents are considered property of the creator and are to be treated as such with respect to use in other applications. Any use of this software for any purpose whatsoever must have explicit permission from the author of the file. This code is part of an ongoing development process for future possible products, and so is considered private property.
Do not use without permission. Author: Scott C. Ziegler <Aslan@Narnia.net>
*/
package Arcana;
import java.io.*;
import java.util.*;
import java.util.zip.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.JFileChooser;
public class SpellFile {
static final String DEFAULT_FILENAME = "untitled.spellbook";
File spellFile;
String currentPath;
SpellBook storedBook;
public SpellFile() {
spellFile = new File(DEFAULT_FILENAME);
storedBook = new SpellBook();
}
public SpellFile(String path) {
spellFile = new File(path);
currentPath = path;
storedBook = new SpellBook();
}
// Methods:
public void setPath(String path) {
currentPath = path;
}
public String getPath() {
return currentPath;
}
public SpellBook load() {
// if (currentPath.compareTo("") == 0) load(DEFAULT_FILENAME);